package bean;

import java.sql.Date;
import java.util.Objects;

public class User {
    public static final int MAX_USER_NAME_LENGTH = 20;
    public static final int MAX_ADDRESS_LENGTH = 200;
    private int userId;
    private String userName;
    private int sex;
    private Date birthdate;
    private String address;

    public User() {
    }

    public User(String userName, int sex, Date birthdate, String address) {
        this.userName = userName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.address = address;
    }

    public User(int userId, String userName, int sex, Date birthdate, String address) {
        this.userId = userId;
        this.userName = userName;
        this.sex = sex;
        this.birthdate = birthdate;
        this.address = address;
    }
    
    public static boolean verifyUserName(String userName) {
        if (Objects.nonNull(userName) && userName.length() > 0 && userName.length() < MAX_USER_NAME_LENGTH) {
            return true;
        }
        return false;
    }
    
    public static boolean verifyAddress(String address) {
        if (Objects.nonNull(address) && address.length() > 0 && address.length() < MAX_ADDRESS_LENGTH) {
            return true;
        }
        return false;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public Date getBirthdate() {
        return birthdate;
    }

    public void setBirthdate(Date birthdate) {
        this.birthdate = birthdate;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
